//
//  BiIndexSaleViewController.m
//  TrunkIndustryManageSystem
//
//  Created by WT_lyy on 15/4/20.
//  Copyright (c) 2015年 李璐西. All rights reserved.
//

#import "BiIndexSaleViewController.h"
#import "BiSaleApplyViewController.h"
#import "BiSaleListViewController.h"
#import "BiSaleApplyManageViewController.h"
@interface BiIndexSaleViewController ()

@end

@implementation BiIndexSaleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setNavBarWithHidden:NO];
    
    [self setNavBarTitle:@"整车销售"];
    
    [self setNavBackBtn];
    
    for (NSInteger i = 0; i < 6; i++) {
    
        NSInteger row = i/2;
        
        NSInteger col = i%2;
        
        UIButton * button = GET_BUTTON(CGRectMake(160*col, MAIN_SCREEN_HEIGHT-(3-row)*40, 160, 40), 16, NO,[UIColor blackColor]);
        
        button.layer.borderWidth = 0.25;
        
        button.layer.borderColor = [UIColor lightGrayColor].CGColor;
        
        [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
        
        [self.view addSubview:button];
        
        button.tag = i;
        
        if (0 == i) {
            
            [button setTitle:@"申请行销" forState:UIControlStateNormal];
        }else if (1 == i){
            
            [button setTitle:@"申请列表" forState:UIControlStateNormal];
        }else if (2 == i){
            
            [button setTitle:@"执行列表" forState:UIControlStateNormal];
        }else if (3 == i){
            
            [button setTitle:@"审批列表" forState:UIControlStateNormal];
            
        }else if (4 == i){
            [button setTitle:@"合同列表" forState:UIControlStateNormal];
            
        }else if (5 == i){
            [button setTitle:@"交接列表" forState:UIControlStateNormal];
            
        }
    }
}

- (void)buttonClick:(UIButton *)button{

    UIViewController * viewCtrl = nil;
    
    switch (button.tag) {
        case 0:
            
            viewCtrl = [[BiSaleApplyViewController alloc] init];
            break;
        case 1:
            
            viewCtrl = [[BiSaleListViewController alloc] init];
            break;
        case 2:
           
            break;
        case 3:
            viewCtrl = [[BiSaleApplyManageViewController alloc] init];
            break;
        case 4:
            
            break;
        case 5:
            
            break;
        default:
            break;
    }
    
    if (!viewCtrl) {
        
        return;
    }
    
    [self.navigationController pushViewController:viewCtrl animated:YES];
    
}


@end
